function promiseQueue<T = unknown>(promises: (() => Promise<T>)[]) {
  return promises.reduce((p, next) => p.then(next as any), Promise.resolve());
}

export const inject = () => {
  window.Promise.queue = promiseQueue as any;
};

export default promiseQueue;
